package com.fypg.module.blooddonation.api.controller.app.bloodDonation;

import com.fypg.framework.common.pojo.CommonResult;
import com.fypg.module.blooddonation.api.client.dal.bloodStation.DictionaryItem;
import com.fypg.module.blooddonation.api.controller.app.bloodDonation.vo.*;
import com.fypg.module.blooddonation.api.service.bloodDonation.BloodDonationService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.parameters.RequestBody;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;
import java.util.List;

/**
 * 献血服务控制器
 *
 * @author 盘古
 */
@RestController
@RequestMapping("/blood/donation")
@RequiredArgsConstructor
@Validated
@Tag(name = "献血服务接口")
public class BloodDonationController {

    private final BloodDonationService bloodDonationService;

    /**
     * 获取字典类型列表
     */
    @PostMapping("/GetDic")
    @Operation(summary = "获取字典类型列表")
    public CommonResult<List<DictionaryItem>> getDictionaryTypeList(@Valid @RequestBody DictionaryReqVO inputModel) {
        List<DictionaryItem> result = bloodDonationService.getDictionaryTypeList(inputModel);
        return CommonResult.success(result);
    }

    /**
     * 获取献血排班列表
     */
    @PostMapping("/GetTimeAppCount")
    @Operation(summary = "获取献血排班列表")
    public CommonResult<List<GetBloodDonationScheduleListRespVO>> getBloodDonationScheduleList(
            @Valid @RequestBody GetBloodDonationScheduleListReqVO inputModel) {
        List<GetBloodDonationScheduleListRespVO> result = bloodDonationService.getBloodDonationScheduleList(inputModel);
        return CommonResult.success(result);
    }

    /**
     * 获取献血详情
     */
    @PostMapping("/GetBloodApp")
    @Operation(summary = "获取献血详情")
    public CommonResult<GetBloodDonationDetailRespVO> getBloodDonationDetail(
            @Valid @RequestBody GetBloodDonationDetailReqVO inputModel) {
        GetBloodDonationDetailRespVO result = bloodDonationService.getBloodDonationDetail(inputModel);
        return CommonResult.success(result);
    }

    /**
     * 获取献血记录信息
     */
    @PostMapping("/donchkTestResults")
    @Operation(summary = "获取献血记录信息")
    public CommonResult<GetBloodDonationRecordInfoRespVO> getBloodDonationRecordInfo(
            @Valid @RequestBody GetBloodDonationRecordInfoReqVO inputModel) {
        GetBloodDonationRecordInfoRespVO result = bloodDonationService.getBloodDonationRecordInfo(inputModel);
        return CommonResult.success(result);
    }

    /**
     * 新增献血预约
     */
    @PostMapping("/BloodApp")
    @Operation(summary = "新增献血预约")
    public CommonResult<AddBloodDonationOrderRespVO> addBloodDonationOrder(
            @Valid @RequestBody AddBloodDonationOrderReqVO inputModel) {
        AddBloodDonationOrderRespVO result = bloodDonationService.addBloodDonationOrder(inputModel);
        return CommonResult.success(result);
    }
}
